var intersection = function (nums1, nums2) {

    const set1 = new Set(nums1);
    let b = nums2.filter(item => set1.has(item));
    let ans = [...new Set(b)];
    return ans
};